package com.myapp.ruyixing.http;

import org.json.JSONArray;
import org.json.JSONObject;

import com.myapp.ruyixing.model.Member;

public class MemberDetailParser extends RYJSONParser {

	@Override
	public Object parse(JSONObject jsonObject) {
		if (getErrno(jsonObject) != NO_ERROR) {
			return null;
		}

		Member member = new Member();

		JSONArray data = jsonObject.optJSONArray("data");
		if (data != null && data.length() > 1) {
			JSONObject sub2 = data.optJSONObject(1);

			if (sub2 != null) {
				member = loadByGson(sub2, Member.class);
			}
		}

		return member;
	}
}
